<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <h3> Nature is God's gift...</h3>


</head>
<body>
<div class="images">
    <img id="1" src="img/1.jpg" />

    <br>
</div>
<div class="container">

    <button id="first">  Prev </button>
    <button id="second"> Next  </button>
</div>

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
    $(document).ready(function() {
        console.log("Jquery is started");

        (function () {
            $('#second').click(function (re) {


                //for(var k=1;k<=2; ++k) {
                // var n= k+1;
                // console.log(n);
                var n=1;

                var   k = n + 1; //click value
                var re  = $('img').attr('src', 'img/'+k+'.jpg');
                return re;

                // }
            });
        })();

        (function () {
            $("#first").click(function () {
                console.log("if button is clicked value is decreased");

                $('img').attr('src','img/1.jpg');
            });
        })();


    });
</script>

</body>
</html>